-
Notifications
You must be signed in to change notification settings - Fork 393
refactor: use last_moved_timestamp instead of scanning edit_history(#1397) #2058
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
refactor: use last_moved_timestamp instead of scanning edit_history(#1397) #2058
Conversation
Replace inefficient edit_history scanning with direct last_moved_timestamp lookup to improve performance when determining when items were last moved. Fixes zulip#1397
chrisbobbe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment below, from a quick skim. Also, this PR needs tests.
lib/api/model/model.dart
Outdated
| // Old server: need to scan edit_history to determine if content was edited. | ||
| final editHistory = json['edit_history'] as List<dynamic>?; | ||
| if (editHistory == null) return lastEditTimestamp; | ||
|
|
||
| // Find the timestamp of the first content edit. | ||
| for (final entry in editHistory) { | ||
| if (entry['prev_content'] != null) { | ||
| return entry['timestamp'] as int?; | ||
| } | ||
| } | ||
| return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is meant to replace the history-scanning code in MessageEditState._readFromMessage, right? But that code is still present, untouched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but in the issue I observed other contributor plan was to use editHistory too.
But after you point out this I checked is it neccessary to keep that, but I conclude to that it is not necessary and everything is working correctly on the new server.
@chrisbobbe now could you check ?
|
Hi @chrisbobbe, |
Replace inefficient edit_history scanning with direct last_moved_timestamp lookup to improve performance when determining when items were last moved.
Fixes #1397